<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=div, initial-scale=1.0">
  <title>3D旋转效果</title>
  <style>
    * {
      margin: 0px;
      padding: 0px;
    }

    html {
      overflow: hidden;
      height: 100%;
      background: linear-gradient(rgb(33, 179, 156) 0%, #000 100%);
    }

    .title {
      color: rgb(255, 0, 200);
      text-align: center;
      text-shadow: 0px 1px 0px #999, 0px 2px 0px #888, 0px 3px 0px #777, 0px 4px 0px #666, 0px 5px 0px #555, 0px 6px 0px #444, 0px 7px 0px #333, 0px 8px 7px #001135;
      font-size: 40px;
    }

    .cube {
      position: relative;
      margin: 0px auto;
      margin-top: 9%;
      margin-left: 42%;
      width: 300px;
      height: 300px;
      transform: rotateX(-30deg) rotateY(-70deg);
      transform-style: preserve-3d;
      animation: rotate 15s infinite;
    }

    .cube .outerImg-cube,
    .cube .innerImg-cube {
      transform-style: preserve-3d;
    }

    /* 旋转立方体 */
    @keyframes rotate {
      from {
        transform: rotateX(0deg) rotateY(0deg);
      }

      to {
        transform: rotateX(360deg) rotateY(360deg);
      }
    }

    /* 外层立方体样式 */
    .outerImg-cube .outerImg-top,
    .outerImg-cube .outerImg-bottom,
    .outerImg-cube .outerImg-right,
    .outerImg-cube .outerImg-left,
    .outerImg-cube .outerImg-front,
    .outerImg-cube .outerImg-back {
      position: absolute;
      top: 0;
      left: 0;
      width: 300px;
      height: 300px;
      border: 1px solid #fff;
      opacity: 0.3;
      transition: all .9s;
      background: linear-gradient(rgb(31, 73, 67) 0%, #000 100%);
    }

    .outerImg-cube img {
      width: 300px;
      height: 300px;
    }


    .outerImg-top {
      transform: rotateX(90deg) translateZ(150px);
    }

    .outerImg-bottom {
      transform: rotateX(-90deg) translateZ(150px);
    }

    .outerImg-front {
      transform: rotateY(0deg) translateZ(150px);
    }

    .outerImg-back {
      transform: translateZ(-150px) rotateY(180deg);
    }

    .outerImg-left {
      transform: rotateY(90deg) translateZ(150px);
    }

    .outerImg-right {
      transform: rotateY(-90deg) translateZ(150px);
    }

    /* 嵌套的内层立方体样式 */
    .innerImg-cube>div {
      position: absolute;
      top: 60px;
      left: 60px;
      width: 180px;
      height: 180px;
    }

    .innerImg-cube img {
      width: 180px;
      height: 180px;
    }

    .innerImg-top {
      transform: rotateX(90deg) translateZ(90px);
    }

    .innerImg-bottom {
      transform: rotateX(-90deg) translateZ(90px);
    }

    .innerImg-front {
      transform: rotateY(0deg) translateZ(90px);
    }

    .innerImg-back {
      transform: translateZ(-90px) rotateY(180deg);
    }

    .innerImg-left {
      transform: rotateY(90deg) translateZ(90px);
    }

    .innerImg-right {
      transform: rotateY(-90deg) translateZ(90px);
    }

    .cube:hover .outerImg-top {
      right: -70px;
      bottom: -70px;
      opacity: 0.8;
      transform: rotateX(90deg) translateZ(200px);
    }

    .cube:hover .outerImg-bottom {
      right: -70px;
      bottom: -70px;
      opacity: 0.8;
      transform: rotateX(-90deg) translateZ(200px);
    }

    .cube:hover .outerImg-front {
      right: -70px;
      bottom: -70px;
      opacity: 0.8;
      transform: rotateY(0deg) translateZ(200px);
    }

    .cube:hover .outerImg-back {
      right: -70px;
      bottom: -70px;
      opacity: 0.8;
      transform: translateZ(-200px) rotateY(180deg);
    }

    .cube:hover .outerImg-left {
      right: -70px;
      bottom: -70px;
      opacity: 0.8;
      transform: rotateY(90deg) translateZ(200px);
    }

    .cube:hover .outerImg-right {
      right: -70px;
      bottom: -70px;
      opacity: 0.8;
      transform: rotateY(-90deg) translateZ(200px);
    }

    .message .author {
      position: absolute;
      right: 50px;
      background-image: -webkit-linear-gradient(left, blue, #66ffff 10%, #cc00ff 20%, #CC00CC 30%, #CCCCFF 40%, #00FFFF 50%, #CCCCFF 60%, #CC00CC 70%, #CC00FF 80%, #66FFFF 90%, blue 100%);
      font-size: 35px;
      -webkit-text-fill-color: transparent;
      -webkit-background-clip: text;
      -webkit-background-size: 200% 100%;
      -webkit-animation: masked-animation 4s linear infinite;
    }

    @keyframes masked-animation {
      0% {
        background-position: 0 0;
      }

      100% {
        background-position: -100% 0;
      }
    }

    .message .tip {
      position: absolute;
      right: 0px;
      margin-top: 60px;
      color: red;
      font-size: 18px;
    }
  </style>
</head>

<body>

  <div class="cube">
    <!-- 外层立方体 -->
    <div class="outerImg-cube">
      <div class="outerImg-top">
        <img src="../assets/3dimages/photo1.png" />
      </div>
      <div class="outerImg-bottom">
        <img src="../assets/3dimages/photo2.png" />
      </div>
      <div class="outerImg-front">
        <img src="../assets/3dimages/photo3.png" />
      </div>
      <div class="outerImg-back">
        <img src="../assets/3dimages/photo4.png" />
      </div>
      <div class="outerImg-left">
        <img src="../assets/3dimages/photo5.png" />
      </div>
      <div class="outerImg-right">
        <img src="../assets/3dimages/photo6.png" />
      </div>
    </div>
    <!-- 内层立方体 -->
    <div class="innerImg-cube">
      <div class="innerImg-top">
        <img src="../assets/3dimages/photo.png" />
      </div>
      <div class="innerImg-bottom">
        <img src="../assets/3dimages/photo7.png" />
      </div>
      <div class="innerImg-front">
        <img src="../assets/3dimages/photo8.png" />
      </div>
      <div class="innerImg-back">
        <img src="../assets/3dimages/photo9.png" />
      </div>
      <div class="innerImg-left">
        <img src="../assets/3dimages/photo10.png" />
      </div>
      <div class="innerImg-right">
        <img src="../assets/3dimages/photo11.png" />
      </div>
    </div>
  </div>
  <div>
    <div class="message">
      <div class="author">
        悄咪咪的复习下css特性
      </div>
      <div class="tip">
        温馨提示：鼠标移入移出立方体，将会显示效果！
      </div>
    </div>
  </div>
</body>

</html>